package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.MainStickerBean;
import com.project.mapper.IMainMapper;
import com.project.service.IMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;
@Service
@Transactional
public class MainServiceImpl implements IMainService {
    @Autowired
    private IMainMapper mapper;


    @Override
    public void add(MainStickerBean mainSticker) {
       mapper.add(mainSticker);
    }

    @Override
    public PageInfo<MainStickerBean> findByItem(int pageNum,int chanelId, String name, String author, LocalDate startDate, LocalDate endDate) {
        PageHelper.startPage(pageNum,PAGESIZE);
        PageInfo info = PageInfo.of(mapper.findByItem(name,author,chanelId, startDate, endDate));
        return info;
    }
}
